
<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html" charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-siteapp" />

<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="author" content="www.rsnet.com.cn" />

<meta name="format-detection" content="telephone=no" />
<meta name="format-detection" content="email=no" />
<meta name="msapplication-tap-highlight" content="no" />
<meta name="x5-orientation" content="portrait">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>

<head>
<title>测试正则匹配</title>
<script src="libs/Achilles.js"></script>
<script>
var a = Achilles;

let c0 = a;
let c1 = c0.setValue(1).isStr();
console.log(c1)


</script>
</head>
<style type="text/css">
table{font-size:12px;}
td{border:1px solid #333;}
.arr0,
.arr2,
.arr4,
.arr6,
.arr8,
.arr10{
  background-color:#ddd;
}

.arr1,
.arr3,
.arr5,
.arr7,
.arr9,
.arr11{
  background-color:#bbb;
}
.true{color:green;}
.false{color:red;}
b{color:#333;}
i{color:#f00;}
</style>
<body>


<script type="text/javascript">


var argumentsCheck = {
  "number":new RegExp(/^[0-9]*$/)
  ,"normalMoney":new RegExp(/^[0-9]+(.[0-9]{0,2})?$/)//可以有两位小数的正实数
  ,"realNumber":new RegExp(/^(\-|\+)?\d+(\.\d+)?$/)//正数、负数、和小数
  ,"PositiveNumber":new RegExp(/^[1-9]\d*$/)//正整数
  ,"unNegtiveNumber":new RegExp(/^[1-9]\d*|0$/)//非负整数||含零正数
  ,"NegtiveNumber":new RegExp(/^-[1-9]\d*$/)//负整数 
  ,"unPositiveNumber":new RegExp(/^-[1-9]\d*|0$/)//非正整数||含零负数
  ,"zeroPositiveInterval":new RegExp(/^[1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0$/)//非负浮点||含零正浮点
  ,"zeroNegtiveInterval":new RegExp(/^(-([1-9]\d*\.\d*|0\.\d*[1-9]\d*))|0?\.0+|0$/)//非正浮点||含零负浮点
  ,"zeroPositiveInterval":new RegExp(/^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$/)//正浮点
  ,"zeroNegtiveInterval":new RegExp(/^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/)//负浮点
  ,"float":new RegExp(/^(-?\d+)(\.\d+)?$/)//浮点数
  
  ,"Chinese":new RegExp(/^[\u4e00-\u9fa5]{0,}$/)//汉字
  ,"English":new RegExp(/^[A-Za-z]+$/)//英文
  ,"enUpp":new RegExp(/^[A-Z]+$/)//大写英文
  ,"enLow":new RegExp(/^[a-z]+$/)//小写英文
  ,"normalPassWord":new RegExp(/^[\u4E00-\u9FA5A-Za-z0-9_]+$/)//中文、英文、数字包括下划线
  ,"highPassWord":new RegExp(/[^~\x22]+/)//可以输入含有^%&',;=?$\"等字符：[^%&',;=?$\x22]+ 12 禁止输入含有~的字符
}

var tA0 = [
  'abc'
  ,'ab_c'
  ,'ABC'
  ,'AB_C'
  ,'a1b'
  ,'1ba'
  ,'0ba'
  ,'简体中文'
  ,'繁體中文'
]
var tA1 = ["",1,true,false,undefined,null,[1,2,3],function(a,b){return a+b;},{"a":0,"b":1}];
var tA2 = [-1.12,-1,-0.1,0,0.1,1,1.12,2.123,3.1234,4.12345];
var tA3 = ["-1.12","-1","-0.1","0","0.1","1","1.12","2.123","3.1234","4.12345"];
var tA4 = ['~','!','@','#','$','%','^','&','*','(',')','_','+'];
var tA5 = ['`','1','2','3','4','5','6','7','8','9','0','-','='];
var tA6 = ['Q','W','E','R','T','Y','U','I','O','P','{','}','|'];
var tA7 = ['q','w','e','r','t','y','u','i','o','p','[',']'];
var tA8 = ['A','S','D','F','G','H','J','K','L',':','"'];
var tA9 = ['a','s','d','f','g','h','j','k','l',';',"'"];
var tA10 = ['Z','X','C','V','B','N','M','<','>','?'];
var tA11 = ['z','x','c','v','b','n','m',',','.','/'];
//以上是用于测试的数据
var data = [tA0,tA1,tA2,tA3,tA4,tA5,tA6,tA7,tA8,tA9,tA10,tA11];//组合一下用于测试的数据，用于循环
var html = '<table><tbody>';
for(var i=0;i<data.length;i++){

  html+='<tr class="arr'+i+'">';
  html+='<th></th>';
  for(var j=0;j<data[i].length;j++){
    html+='<td class="node">'+data[i][j]+'</td>'
  }
  html+='</tr>';
  // 输出测试数据

  html+='<tr class="arr'+i+'">';
  html+='<th>typeof</th>';
  for(var j=0;j<data[i].length;j++){
    html+='<td class="typeof">'+typeof(data[i][j])+'</td>'
  }
  html+='</tr>';
  // 输出typeof用于批判

  html+='<tr class="arr'+i+'">';
  html+='<th>Object.prototype.toString.call()</th>';
  for(var j=0;j<data[i].length;j++){
    html+='<td class="optc">'+Object.prototype.toString.call(data[i][j])+'</td>'
  }
  html+='</tr>';
  // 输出Object.prototype.toString.call()

  for (key in argumentsCheck){
    html+='<tr><th>'+key+'</th>';
    for(index in data[i]){
      var tf = argumentsCheck[key].test(data[i][index])
      html+='<td class="'+tf+'">'+tf+'</td>';
    }
    html+='</tr>';
  }
  // 输出各种正则的测试结果
}
html+='</table></tbody>';
document.write(html);

</script>

</body>
</html>
